package com.echo.blog.business.elasticsearch.model;

import com.netflix.discovery.provider.Serializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.CompletionField;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.core.completion.Completion;

/**
 * <p>
 * <p>
 * </p>
 *
 * @author chentl123
 * @since 2019-09-05
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Serializer
@Document(indexName = "echoblogs", type = "blog")
public class EsBlog {

    private static final long serialVersionUID = 1L;

    @Id
    private String id;

    /**
     * 标题
     */
    @Field(type = FieldType.text, analyzer = "ik_max_word")
    private String title;
    /**
     * 简介
     */
    @Field(type = FieldType.text, analyzer = "ik_max_word")
    private String intro;
    /**
     * 博客预览图像
     */
    @Field(type = FieldType.text, analyzer = "ik_max_word")
    private String coverUrl;
    /**
     * 创建时间
     */
    @Field(type = FieldType.text)
    private String createTime;
    /**
     * 更新时间
     */
    @Field(type = FieldType.text)
    private String updateTime;

    /**
     * 搜索建议类  存储关键词
     */
    @CompletionField(maxInputLength = 100, analyzer = "ik_max_word")
    private Completion suggest;


}
